package com.google.code.stalkernet.advertisements.event;

import java.util.EventObject;

import com.google.code.stalkernet.advertisement.Advertisement;

/**
 * Encapsulates details of advertisements-related event.
 *
 * @author Mikhail Vladimirov
 */
public class AdvertisementsEvent extends EventObject
{
    private final Advertisement advertisement;

    /**
     * Create new advertisements event with given source and
     * {@link Advertisement}.
     *
     * @param source event source
     * @param advertisement {@link Advertisement}
     */
    public AdvertisementsEvent (Object source, Advertisement advertisement)
    {
        super (source);

        if (advertisement == null)
            throw new IllegalArgumentException ("Advertisement is null");

        this.advertisement = advertisement;
    }

    /**
     * Get {@link Advertisement}.
     *
     * @return {@link Advertisement} object
     */
    public Advertisement getAdvertisement ()
    {
        return advertisement;
    }
}
